package org.gtiles.components.login.authentication.impl;

import org.gtiles.components.login.authentication.IAuthenticateAction;
import org.gtiles.components.login.authentication.IAuthenticatedUser;
import org.gtiles.components.login.authentication.impl.AuthenticatedUserImpl;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class Properties2AuthenticateAction implements IAuthenticateAction{
	
	@Override
	public IAuthenticatedUser doAuthenticate(String userName)
			throws AuthenticationException {
		String adminUser = "Gr";
		String adminPassword = "Gr";
		if(adminUser.equals(userName)){
			return new AuthenticatedUserImpl(userName,userName,adminPassword);
		}else{
			throw new UsernameNotFoundException("登录失败，账户或密码错误："+userName);
		}
	}


}
